package algorithm.test1Tree.test2BST;

import org.junit.Test;

public class ClientTest {
    @Test
    public void test1(){
        Integer data[]={7,4,9,2,1,3,5,9,8,11,10,12};
        BinarySearchTree<Integer> tree=new BinarySearchTree<>();
        for(Integer a:data){
            tree.add(a);
        }
        System.out.println(tree.treeHeight2());
       /* System.out.println("-------》前序遍历开始");
        tree.cusPreOrder();
        System.out.println("-------》中序遍历开始");
        tree.cusMiddleOrder();
        System.out.println("-------》后序遍历开始");
        tree.lastOrder();
        System.out.println("-------》层序遍历开始");
        tree.levelOrder();*/


    }

    /**
     * 树的高度
     */
    @Test
    public void test2(){
        Integer data[]={7,4,9,2,1,3,5,9,8,11,10,12};
        BinarySearchTree<Integer> tree=new BinarySearchTree<>();
        for(Integer a:data){
            tree.add(a);
        }

        int a=tree.treeHeight();
        int b= tree.treeHeight2();
        System.out.println("-------》树的高度1--->"+a);
        System.out.println("-------》树的高度2--->"+b);
    }

    @Test
    public void test3(){
        //Integer data[]={7,4,9,2,1,3,5,9,8,11,10,12};
        Integer data[]={7,4,9,2,5};
        BinarySearchTree<Integer> tree=new BinarySearchTree<>();
        for(Integer a:data){
            tree.add(a);
        }
        System.out.println(tree.checkCompleteTree());
    }
}
